<?php

require_once(TEST_INTEGRATION_PATH . 'ProductsDAO.php');
require_once(TEST_CONFIGURATION_PATH . 'Configuration.php');

class TestOfOrdersProductsFind extends UnitTestCase {
	
	private $cf;
	private $product;
	
	function __construct() {
		$this->product = new ProductsDAO;
		$this->cf = new Configuration(new ConnectionFactory());
	}

	function testShouldSelectCorrectProductID() {
		$test = $this->product->find(1);
		$this->assertEqual($test->pid, 1);
	}
	
	function testShouldSelectCorrectPrice() {
		if ($this->cf->get('DISPLAY_PRICE_WITH_TAX') == 'true'){
			$dummyPrice = ((299.9900/100) * 7) + 299.9900;
		} else {
			$dummyPrice = 299.9900;
		}

		$test = $this->product->find(1);
		
		$this->assertEqual($test->price, round($dummyPrice, 2));
	}
	
	function testShouldSelectCorrectName() {
		$test = $this->product->find(1);
		$this->assertEqual($test->name, "Matrox G200 MMS");
	}
}

?>
